//模块主窗口
ToSignQuestionListPanel = Ext.extend(Ext.Panel,{
	 closable: true,
   	 autoScroll:true,
   	 width:'100%',
   	 initComponent : function() {
   			this.tbar =  this.buildBbar() ;
   			var gd = new ToSignQuestionListGrid() ;
   			this.items = [gd] ;
			
   		ToSignQuestionListPanel.superclass.initComponent.call(this);
   	 },
   	 buildBbar: function() {
		return ['->',{
                      text:'操作说明'          
                      ,iconCls:'ico-dot-question'
                      ,handler:function(btn){}
		}]
   	 },
   	 exportData:function(btn) {
   		
   		
   	} ,
   	listeners : {
   		'activate':function(com){
   		var a = com;
   			com.items.get(0).getStore().load({
					params:{
					start:0,
					limit:100
					}
			});
   			return true;
   		}
   	}
});

signTask = function(a,b) {
	alert(b);
}

//高额用户信息列表
ToSignQuestionListGrid = Ext.extend(Ext.grid.GridPanel,{
	title : '高额用户信息列表',
	header: false,
	loadMask:{msg:'加载中...'},
	enableDragDrop: false,
	columnLines:true,
	height: 600,
	viewConfig :{
        forceFit: true
    },
	initComponent : function() {
       	var thisGrid = this;
       	this.recordStart = 1 ;
    	var checkBoxCm = new Ext.grid.CheckboxSelectionModel({
				dataIndex: "uid",
                sortable: false,
                singleSelect:false,
                width:20
		});
		var recordNum = new　Ext.grid.RowNumberer({
		　　header　:　"序号",
		　　width　:　35,
		　　renderer:function(value,metadata,record,rowIndex){
		　　　return　　thisGrid.recordStart　+　rowIndex;
		　　}
		});
		
		
		
		this.columns　=　[checkBoxCm,recordNum,　
		    {
				header:'稽核点名称',
				sortable:true,
				dataIndex:"taskName"
			},{
				header:'稽核任务名称',
				sortable:true,
				dataIndex:"taskDesc"
			},{
				header:'问题描述',
				sortable:true,
				dataIndex:"issueDec",
				width:200,
				renderer: function(value, metaData, record, rowIndex, colIndex, store) {
		   			metaData.attr = ' ext:qtip="' + value + '"';
		   			return value;
		   		}
			},{
				header:'严重级别',
				sortable:true,
				dataIndex:"warnLevel",
				width:50
			},{
				header:'维护组',
				sortable:true,
				dataIndex:"gropName"
			},{
				header:'创建时间',
				sortable:true,
				dataIndex:"createDate"
			},{
				header:'签收',
				xtype: 'actioncolumn',
            	width: 50,
            	align :"center",
           		items: [
                {
                    icon   : 'images/add.gif',                // Use a URL in the icon config
                    tooltip: '签收',
                    handler: function(grid, rowIndex, colIndex) {
                    	
							  var taskId = grid.getStore().getAt(rowIndex) .data['id']; 
							  //MsgTip.msg('消息', '设置10秒后自动隐藏'+taskId,true,5);
							  Ext.Ajax.request({
							    url:"work_claimTask.action?taskId="+taskId, 
							    success:function (response) {
									var Result=Ext.decode(response.responseText);
									if(Result.success) {
										//MsgTip.msg('消息', '签收任务成功~',grid,true,3);
										 MsgTip.msg({
										 	msg:"签收任务成功~",
										 	cmp:grid,
										 	pos:"botl"
										 });
										grid.getStore().reload();
									}else{
									//MsgTip.msgt("消息","任务签收失败~~",grid,true,3 );
									MsgTip.msg({
									 	msg:"任务签收失败~~",
									 	cmp:grid,
									 	pos:"botl"
									 });
									}
								  }
							   });
                    }
                }]
			}] ;
		var dataStore = new Ext.data.JsonStore({
			url : 'work_getToSignTaskList.action',
			root: 'root',
	        totalProperty: 'totalProperty',
	        idProperty: 'id',
	        fields: [
				'id','createDate','gropId','gropName','workDefineName','issueDec','taskName','taskDesc','procDefId','procInstId','taskDefKey','text','warnLevel'	        ]
		});
	
	    dataStore.baseParams ={'highFeeUser':null};
		this.store = dataStore;
		this.sm = checkBoxCm;
		this.mk=new Ext.LoadMask(Ext.getBody(),{
							msg:'正在努力为您加载数据，请稍候...'
				});
		this.bbar = new Ext.PagingToolbar({
			pageSize : 100,
			store : dataStore,
			displayInfo : true,
			displayMsg : '第 {0} - {1} 条  共 {2} 条',
			emptyMsg : "没有记录",
			listeners:{
				beforechange:function(pt,obj) {
					thisGrid.recordStart = obj.start+1 ;
				}
			}
		});
	ToSignQuestionListGrid.superclass.initComponent.call(this);
	},
	listeners : {
   		'afterrender':function(com) {
   			com.getStore().load({
					params:{
					start:0,
					limit:100
					}
			});
   		}
   	},
	signTask:function(taskId,grid) {
		alert(1)
	}
});




